/*
 * Copyright (C) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
export { hapTasks } from '@ohos/hvigor-ohos-plugin';
// import {}from '@ohos/hvigor'
//
// const mModule = getHvigorNode(__filename);
// const ohosPlugin = hapTask(mModule);
//
// const onlineSignHapTaskName = 'onlineSignHap';
//
// const config = {
//   hvigor: hvigor,
//   packageConfig: {
//     appName: 'phone_deviceswitch',
//     commandParams: hvigor.getExtraConfig(),
//     module: mModule
//   }
// }
//
// initTesting(config);
// let curTargetName = 'default';
// const mModuleName = mModule.getName();
// const projectRootPath = process.cwd();
// const productPath: string = 'product';
//
// const entryName = '';
//
// ohosPlugin.getNeedExecTargetServiceList().foreach(targetServices => {
//   curTargetName = targetServices.getTargetData().getTargetName();
//
//   const onlineSignTask = mModule.task(() => {
//     const moduleBuildOutputDir = path.resolve(projectRootPath, productPath, 'phone', `deviceswicth/build/default/outputs/${curTargetName}/`);
//
//     const inputFile = path.resolve(moduleBuildOutputDir, `${mModuleName}${entryName ? '-' + entryName : ''}-${curTargetName}-unsigned.hap`);
//
//     const outputFile = path.resolve(moduleBuildOutputDir, `${mModuleName}${entryName ? '-' + entryName : ''}-${curTargetName}-signed.hap`);
//     executeOnlineSign(inputFile, outputFile);
//
//   }, onlineSignHapTaskName).dependsOn(`${curTargetName}@PackageHap`);
//
//   if (onlineSignTask.getEnabled()) {
//     mModule.getTaskByName(`${curTargetName}@SignHap`).setEnabled(false);
//   }
// });
//
// mModule.getTaskByName(`assembleHap`).dependsOn(onlineSignHapTaskName);
//
// module.exports = {
//   ohos: ohosPlugin
// }